import BuffUtil from '@/BuffUtil';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 冰霜之魂 - 冰霜攻击
 **/
export default class MSK_ForstAttack extends AbilityBase {
    static instance: MSK_ForstAttack;
    buffType: AppBuffType = {
        id: 'buff_MSK_ForstAttack',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        attribute: {
            attackSpd_p: -0.05,
            move_speed_p: -0.05,
        },
        stackCountMax: -1,
        dur: 15,
        isDebuff: true,
    };
    constructor(id: string = 'Myh1') {
        super(id);
        MSK_ForstAttack.instance = this;
        this.init();
        // se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
        EventManager.onTakeAttack(this.onSpellEffect.bind(this));
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {}
    onSpellEffect(d: DamageEventData) {
        if (GetUnitAbilityLevel(d.source, this.id) == 0) return;
        let buff = BuffUtil.addBuff(d.target, this.buffType.id, d.source);
        let dmg = UnitCommon.取攻击(d.source) * 0.2 * buff.stackCount;
        DamageSystemInstance.applyIceDamage(d.target, d.source, dmg);
    }
}
